/**
 * 
 */
package vanhoc.android.mediakool.custom.adapter;

import java.util.ArrayList;
import java.util.List;

import vanhoc.android.medialcool.item.data.VideoItemData;
import vanhoc.android.medialcool.item.layout.VideoItemView;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;

/**
 * @author Administrator
 *
 */
public class VideoListAdapter extends ArrayAdapter<VideoItemData> {
	private Context vContext;
	private ArrayList<VideoItemData> arrListVideoData;
	
	
	public VideoListAdapter(Context context, int textViewResourceId,
			List<VideoItemData> objects) {
		super(context, textViewResourceId, objects);
		
		this.vContext	=	context;
		this.arrListVideoData	=	(ArrayList<VideoItemData>) objects;
	}
	
	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		//return super.getView(position, convertView, parent);
		VideoItemView videoItem = new VideoItemView(vContext);
		
		videoItem.videoName.setText(arrListVideoData.get(position).getName());
		videoItem.videoFormat.setText(arrListVideoData.get(position).getFormat() + " |");
		videoItem.videoSize.setText(arrListVideoData.get(position).getSize() + " |") ;
		videoItem.videoArtist.setText(arrListVideoData.get(position).getArtist());
		videoItem.videoDuration.setText(arrListVideoData.get(position).getDuration());
		videoItem.setTag(arrListVideoData.get(position).getID());
		return videoItem;
	}
}
